/**************************************************************************//**
 * @item     CosyOS-III Kernel
 * @file     sv_com.h
 * @brief    内核公共服务
 * @details  在服务层临界区中调用并执行。
 * @author   迟凯峰
 * @version  V2.0.0
 * @date     2025.08.04
 ******************************************************************************/

#ifndef __SV_COM_H
#define __SV_COM_H

#include "os_redef.h"
void      sa_insert_taskque   (s_tasknode_tsp htask);
void      sa_remove_taskque   (s_tasknode_tsp htask);
void      sa_add_ready        (s_tasknode_tsp htask);
void      sa_remove_ready     (s_tasknode_tsp htask);
void      sa_resume_task      (s_tasknode_tsp htask);
void      sa_suspend_task     (s_tasknode_tsp htask);
void      sa_stop_task        (s_tasknode_tsp htask);
void      sa_free_task        (s_tasknode_tsp htask);
void      sa_delete_task      (s_tasknode_tsp htask);
void      sa_clear_block      (s_tasknode_tsp htask);
void      sa_set_block        (s_tasknode_tsp htask, s_delay_t tick);
void      sa_set_taskpri      (s_tasknode_tsp htask, s_u8_t npri);
void      sa_block_to_float   (s_tasknode_tsp htask);
void      sa_float_to_block   (s_tasknode_tsp htask);
void      sa_block_to_ready   (s_tasknode_tsp *h2task);
void      sa_insert_blocklist (s_tasknode_tsp *h2task);
void      sa_remove_blocklist (s_tasknode_tsp htask);
void      sa_insert_timerlist (void);

void      sc_clear_delay      (void);
s_ecode_t sc_resume_task      (s_tasknode_tsp htask);
s_ecode_t sc_suspend_task     (s_tasknode_tsp htask);
s_ecode_t sc_delete_task      (s_tasknode_tsp htask);
s_ecode_t sc_clear_block      (s_tasknode_tsp htask);
s_ecode_t sc_set_block        (s_tasknode_tsp htask, s_delay_t tick);
s_ecode_t sc_set_taskpri      (s_tasknode_tsp htask, s_u8_t npri);
void      sc_write_binary     (s_binary_tsp hbin, bool value);
void      sc_give_semaph      (s_semaph_tsp hsem);
void      sc_send_fetion      (s_tionbox_tsp htbox, m_fetion_t tion);
void      sc_send_mail        (s_mailbox_tsp hmbox, void *mail);
s_ecode_t sc_send_msg         (s_msgque_tsp hque, void *msg);
void     *sc_recv_msg_staque  (s_staque_tsp hque);
void     *sc_recv_msg_dynque  (s_dynque_tsp hque);
void      sc_timint           (s_u8_t tmid, s_timint_t tick);
void      sc_timqry           (s_u8_t tmid, s_timqry_t tick);

#endif
